package com.bs.manager04.utils.exception;

import com.bs.manager04.utils.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 小姚
 * @pakeageName:com.bs.manager04.utils.exception
 * @ClassName:MyException
 * @Descirption:
 * @data 2022/12/17 18:25
 */
@RestControllerAdvice
public class MyException {

    //用户名为空
    @ExceptionHandler(NotUserNullException.class)
    public Result getUserNull(NotUserNullException e){
         return Result.fail(e.getMessage());
    }

    //用户信息不存在
    @ExceptionHandler(NotUserException.class)
    public Result getUserNull(NotUserException e){
        return Result.fail(e.getMessage());
    }

    //用户密码为空
    @ExceptionHandler(PassWordNullException.class)
    public Result getpwdNull(PassWordNullException e){
     return Result.fail(e.getMessage());
    }

    //用户密码不正确
    @ExceptionHandler(PasswordEqualException.class)
    public Result getPwdEqual(PasswordEqualException e){
         return Result.fail(e.getMessage());
    }

    //用户状态不正常
    @ExceptionHandler(StatusException.class)
    public Result getStatus(StatusException e){
        return Result.fail(e.getMessage());
    }

    //用户没有访问权限
    @ExceptionHandler(NoAuthException.class)
    public Result getNotPremission(NoAuthException e){
        return Result.fail(e.getMessage());
    }
}
